<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript" src="js/websocket.js"></script>
		<script type="text/javascript">
			
			ws.init({
				onopen:function(){
					console.info("客户端连接成功...");
				},
				onclose:function(){
					console.info("客户端连关闭...");
				},
				onmessage:function(data){
					console.info("数据:"+data);
				}
			})
			
			
			function sendMsg(){
				var msg = $("#content").val();
				websocket.send(msg);
				$("#showMsg").append("<span>我:"+msg+"</span><br>");
			}
		</script>
	</head>
	<body>
		<div id="showMsg" style="border: 1px solid black; width: 400px;height:300px;">
			
		</div>
		<input type="text" id="content" />
		<button onclick="sendMsg()">发送</button>
	</body>
</html>
